<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ page import="java.util.List" %>
<%@ page import="model.SuShe"%>
<%@ page import="dao.SuSheDao"%>  
<%@ page import="java.net.URLEncoder" %>

<%
	//检查会话中是否有 "admin" 属性
	Object fdyObj = session.getAttribute("admin");
	if (fdyObj == null) {
	    response.sendRedirect("../view/Login.jsp");
	    return;
	}
%>
    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>管理员页面</title>
<link href="../css/Utils.css" rel="stylesheet" type="text/css" />
<link href="../css/List.css" rel="stylesheet" type="text/css" />
<!-- 退出登录专用 -->
   <script type="text/javascript" src="../view/Loginout.js"></script>
</head>
<body>

<!-- 头部 -->
<div class="header" ><br>
<nerong>&nbsp;&nbsp;管理员页面&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;</nerong>

 <button onclick="confirmLogout('<%= (String)session.getAttribute("admin") %>','admin')">退出登录</button>

</div><br>

<div class="left" >
<table width="80%" height="80%">
<th>
<nerong>管理员可选择内容</nerong>
</th>

<tr>
<td>
<a href="../View_Msg/msgAdmin.jsp">&emsp;个人信息</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_xx/XxStudent.jsp">&emsp;学生信息管理</a><br>
</td>
</tr>


<tr>
<td>
<a href="../View_xx/XxFdy.jsp">&emsp;辅导员信息管理</a><br>
</td>
</tr>

<tr>
<td>
<a href="../View_xx/XxSuGuan.jsp">&emsp;宿管信息管理</a><br>
</td>
</tr>

<tr>
<td>
<a href = "../View_xx/XxWy.jsp">&emsp;物业信息管理</a><br>
</td>
</tr>


<tr>
<td>
<a href = "../View_SuShe/SuSheAdminMain.jsp">&emsp;宿舍入住管理</a><br>
</td>
</tr>







</table>



</div>



<div class="context" >
<!-- 这部分是每个大功能的小功能 -->
   
            <h2>宿舍人员入住信息管理</h2>
            
            
            	<%
                    	SuSheDao dao = new SuSheDao();
                 
                    	//调用根据id查信息的getAloneLeaveMessages
                    	List<SuShe> Messages = dao.findAlleRoomSuSheData();
                                                         
                        if (Messages != null && !Messages.isEmpty()) {
                        	
                 %>   		
                 			            	           	           	                      
            	
                <table class="Alltable">
                    <tr>
                    	
                        <th>宿舍号</th>
                        <th>学号</th>
                        <th>姓名格</th>
                        <th>班级</th>
                        <th>操作</th>
                    </tr>
                  
                    <tr>
                       <%    	
                            for (SuShe suShe : Messages) {
                   	%>
                       	
                       	<td><%= suShe.getRoomid() %></td>
                        <td><%= suShe.getStudentId() %></td>                      
                        <td><%= suShe. getStudentName() %></td>   
                         <td><%= suShe. getStudentClass() %></td>                      
                        <td>
                			    
                			<button class="btn btn-green" 
                				onclick="window.location.href='SuSheAdminUpdate.jsp?roomid=<%= URLEncoder.encode(suShe.getRoomid(), "UTF-8") %>&id=<%= URLEncoder.encode(suShe.getStudentId(), "UTF-8") %>&name=<%= URLEncoder.encode(suShe.getStudentName(), "UTF-8") %>&classname=<%= URLEncoder.encode(suShe.getStudentClass(), "UTF-8") %>'">
       						 	修改
   							 </button>
                			
                		</td>
                    </tr>
                    <%
                            }
                        } else {
                    %>
                    <tr>
                        <td colspan="3">没有找到对应的宿舍信息</td>
                    </tr>
                    <%
                        }
                    %>
                </table>
                
                
     
   

</div>

</body>
</html>